package com.ITArmy.service;

import com.ITArmy.beans.Serialize;
import com.ITArmy.beans.UploadUtil;
import com.ITArmy.common.ServerResponse;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

public interface SerializeService {

    /**
     * 新增连载
     *
     * @param serialize serialize
     * @return ServerResponse
     */
    ServerResponse addSerialize(Serialize serialize);

    /**
     * 遍历连载
     *
     * @return ServerResponse
     */
    List<Serialize> findAllSerialize();

    /**
     * 删除连载
     *
     * @param id id
     * @return ServerResponse
     */
    ServerResponse deleteSerialize(Long id);

    /**
     * 批量删除
     *
     * @param ids ids
     * @return ServerResponse
     */
    ServerResponse deleteManyByIds(String[] ids);

    /**
     * 根据id查找连载信息
     *
     * @param id id
     * @return ServerResponse
     */
    ServerResponse findAllSerializeById(Long id);

    /**
     * 根据连载标题模糊搜索
     *
     * @param title title
     * @return ServerResponse
     */
    ServerResponse findAllSerializeByTitle(String title);

    /**
     * 根据连载类型搜索
     *
     * @param tid tid
     * @return ServerResponse
     */
    ServerResponse findAllSerializeByType(Integer tid);

    /**
     * 修改连载信息
     *
     * @param serialize serialize
     * @return ServerResponse
     */
    ServerResponse updateSerialize(Serialize serialize);

    /**
     * 设置为推荐
     *
     * @param id     id
     * @param number number
     * @return ServerResponse
     */
    ServerResponse recommend(Long id, Long number);

    /**
     * 遍历投稿连载
     *
     * @return ServerResponse
     */
    List<Serialize> findContributeSerialize();

    /**
     * 是否上架
     *
     * @param id     id
     * @param number num
     * @return ServerResponse
     */
    ServerResponse putaway(Long id, Long number, String email);

    /**
     * 通过标题查找投稿连载
     *
     * @param title title
     * @return ServerResponse
     */
    ServerResponse findContributeByTitle(String title);

    /**
     * 根据投稿连载类型搜索
     *
     * @param tid tid
     * @return ServerResponse
     */
    ServerResponse findContributeByType(Integer tid);

    /**
     * 遍历推荐免费连载
     * @return ServerResponse
     */
    List<Serialize> recommendList();

    /**
     * 遍历上架连载
     * @return ServerResponse
     */
    List<Serialize> putawayList();

    /**
     * 根据连载类型遍历推荐免费连载
     *
     * @param tid tid
     * @return ServerResponse
     */
    ServerResponse findRecommendByType(Integer tid);

    /**
     * 用户创建新的连载
     *
     * @param request   request
     * @param serialize serialize
     * @return ServerResponse
     */
    ServerResponse setUpSerialize(HttpServletRequest request, Serialize serialize);

    /**
     * 上传连载的封面的图片
     *
     * @param request request
     * @param
     * @return ServerResponse
     */
    ServerResponse uploadCoverPicture(HttpServletRequest request, long sId, MultipartFile multiUploadFile);

    /**
     * 写连载
     *
     * @param request   request
     * @param serialize serialize
     * @return ServerResponse
     */
    ServerResponse wirteSerializre(HttpServletRequest request, Serialize serialize);

    /**
     * 用户删除连载
     *
     * @param SerializeId SerializeId
     * @return ServerResponse
     */
    ServerResponse deleteByUser(long SerializeId);

    /**
     * 获取用户所发表过的所有连载
     */
    List<Serialize> getAllPublicSerialize(HttpServletRequest request);


    ServerResponse Base64Upload(HttpServletRequest request, UploadUtil uploadUtil);
}
